home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / Apple Game Sprockets / InputSprocket / Sample Drivers / ISp Sample ADB Sources / ADBUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-14  |  3.0 KB  |  113 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************
  2.  
  3. File:      ADBUtils.h
  4.  
  5. Copyright © 1996, 1997, 1998 Apple Computer, Inc., All Rights Reserved
  6.  
  7.  
  8. You may incorporate this sample code into your applications without
  9. restriction, though the sample code has been provided "AS IS" and the
  10. responsibility for its operation is 100% yours.  However, what you are
  11. not permitted to do is to redistribute the source as "DSC Sample Code"
  12. after having made changes. If you're going to re-distribute the source,
  13. we require that you make it clear in the source that the code was
  14. descended from Apple Sample Code, but that you've made changes.
  15.  
  16. *************************************************************************************/
  17.  
  18. #ifndef __ADBUTILS__
  19. #define __ADBUTILS__
  20.  
  21. #ifndef __DESKBUS__
  22. #include <DeskBus.h>
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. // handler ids
  30. enum
  31. {
  32.     // handler ids for address 2 (keyboards)
  33.     kHandlerID_Addr2_RegularKeyboard    = 2,
  34.     kHandlerID_Addr2_SplitKeyboard        = 3,
  35.  
  36.     // handler ids for address 3 (relative pointing devices)
  37.     kHandlerID_Addr3_RegularMouse        = 1,
  38.     kHandlerID_Addr3_FastMouse            = 2,
  39.     kHandlerID_Addr3_CrsrDvMgrMouse        = 4,
  40.     kHandlerID_Addr3_Kensington            = 50,
  41.     
  42.     // FESH! devices (address 3)
  43.     kHandlerID_Addr3_CHTrackballPro        = 66,
  44.     kHandlerID_Addr3_MicroSpeed            = 47,
  45.     kHandlerID_Addr3_ContourMouse        = 102,
  46.     kHandlerID_Addr3_NoHandsMouse        = 95,
  47.  
  48.     // handler id for address 4
  49.     kHandlerID_Addr4_Sidewinder3DPro    = 93,
  50.     
  51.     // handler id for address 5
  52.     kHandlerID_Addr5_MacAllyJoystick    = 3  // Added by JAE for MacALLY Joystick
  53. };
  54.  
  55. enum
  56. {
  57.     kADBAddress_Invalid = 16
  58. };
  59.  
  60. typedef UInt8 ADBRegister[9];    // pascal string style (used for adb register contents)
  61.  
  62. /*
  63.  *
  64.  * Easy to use wrapper classes for ADBOp
  65.  *
  66.  * address    = ADB Address of the device
  67.  * reg        = ADB register you want to talk or listen
  68.  * data        = pascal string of the data to send or read from the device
  69.  * 
  70.  * ADBOpSync_SendReset        resets the adb bus
  71.  * ADBOpSync_Flush            flushes an ADB device
  72.  * ADBOpSync_Listen            commands an ADB device to listen to this data
  73.  * ADBOpSync_Talk            command an ADB device to talk about this register
  74.  *
  75.  * These functions automatically retry.
  76.  *
  77.  */
  78.  
  79. void ADBOp_SendResetSync(void);
  80. void ADBOp_FlushSync(ADBAddress address);
  81. void ADBOp_ListenSync(ADBAddress address, UInt8 reg, const ADBRegister inData);
  82. void ADBOp_TalkSync(ADBAddress address, UInt8 reg, ADBRegister outData);
  83.  
  84.  
  85. /*
  86.  *
  87.  * ADBOp_ChangeHandlerIdSync
  88.  *
  89.  * changes the handler id of the device at that adb address
  90.  * returns true if the handler id changed, false otherwise
  91.  *
  92.  */
  93.  
  94. Boolean ADBOp_ChangeHandlerIDSync(ADBAddress inAddress, UInt8 inNewHandlerID);
  95.  
  96. /*
  97.  *
  98.  * ADBTalkSyncReliable
  99.  *  
  100.  * This is like ADBTalkSync but it will do retries on zero length
  101.  * registers.  Some old device for example the A+ Mouse ADB sometimes
  102.  * give a zero length register when it really has data.
  103.  * 
  104.  */
  105.  
  106. void ADBOp_TalkReliableSync(ADBAddress address, UInt8 reg, ADBRegister data);
  107.  
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111.  
  112.  
  113. #endif // __ADBUTILS__